Skip to content

Add setdomainname function#1244

Merged
sunfishcode merged 3 commits into
bytecodealliance:mainfrom
sylfn:setdomainname
Jan 8, 2025
Merged

Add setdomainname function#1244
sunfishcode merged 3 commits into
bytecodealliance:mainfrom
sylfn:setdomainname

Conversation

@sylfn

@sylfn sylfn commented Dec 17, 2024

Copy link
Copy Markdown
Contributor

No description provided.

name: *const c::c_char,
len: c::size_t
) via SYS_setdomainname -> c::c_int
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a quick glance, the libc crate does have declarations for setdomainname; could you comment on why tthis uses syscall! instead of just libc::setdomainname?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out libc::setdomainname isn't there for android (failed CI)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unfortunate to make non-Linux users use a weak symbol though. Could you use libc::setdomainname on all platforms except Android using cfgs?

I also filed rust-lang/libc#4212 to add the declarations to libc for Android.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Use weak `setdomainname` only for android; remove this special case
once [libc#4212] is merged.

[libc#4212]: rust-lang/libc#4212
@sunfishcode sunfishcode merged commit c2ac858 into bytecodealliance:main Jan 8, 2025
@sunfishcode

Copy link
Copy Markdown
Member

Thanks!

sunfishcode pushed a commit that referenced this pull request Jan 21, 2025
* Add setdomainname function

* Use `libc::setdomainname` where possible

Use weak `setdomainname` only for android; remove this special case
once [libc#4212] is merged.

[libc#4212]: rust-lang/libc#4212

* Disable setdomainname on illumos and solaris
sunfishcode pushed a commit that referenced this pull request Jan 21, 2025
* Add setdomainname function

* Use `libc::setdomainname` where possible

Use weak `setdomainname` only for android; remove this special case
once [libc#4212] is merged.

[libc#4212]: rust-lang/libc#4212

* Disable setdomainname on illumos and solaris
@sylfn sylfn deleted the setdomainname branch February 6, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants